
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Image Playback</title>
<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-repeat: no-repeat;
}
</style>


<script type="text/javascript">

//var imageCheck = 0;//Variable to check if page is loaded.

//This is Index.HTML Version 01 GW
function loadSmartImage(nowImage)
{
	//alert("Load DisplayImage  : " + nowImage);
	var elem = document.createElement("img");
	elem.setAttribute("src", nowImage);
	elem.setAttribute("id", "mainImage");
	//elem.setAttribute("height", "354");
	//elem.setAttribute("width", "752");
	elem.setAttribute("height", "354");
	elem.setAttribute("width", "754");
	elem.setAttribute("style", "margin-left:26px; margin-top:109px;");
	//elem.setAttribute("style", "margin-left:26px; margin-top:112px;");
	document.body.appendChild(elem);
}


function loadImage(){
	var today=new Date();
	var D=today.getDate();
	var Mon=today.getMonth();
	var Y=today.getFullYear();
	var h=today.getHours();
	var m=today.getMinutes();
	var s=today.getSeconds();

	//Test
	//m=m-1;
	
	if(s > 30 && s<= 59)
	{
		today =  new Date(today.getTime() + 60000);
	
   		D=today.getDate();
		Mon=today.getMonth();
		Y=today.getFullYear();
		h=today.getHours();
		m=today.getMinutes();
		s=today.getSeconds();
	}
	
	
	Mon=Mon+1;
	
	h=checkTime(h);
	m=checkTime(m);
	s=checkTime(s);
	Mon=checkTime(Mon);
	D=checkTime(D);
	Y=checkTime(Y);
	

	var nowImage = "file:///Users/Shared/MM/MM_"+Mon+"-"+D+"-"+Y+"_"+h+"_"+m+"_00.jpg";
	
   // alert("Current Image Path : " + nowImage);

	
	var img = new Image();
    img.onload = function() {
      
    	loadSmartImage(nowImage);
    };
  //	img.onerror = function() {
  	
  	//	var m=today.getMinutes();
    //	m=m+1;
    //	m=checkTime(m);
	//	nowImage = "file:///Users/Shared/MM/MM_"+Mon+"-"+D+"-"+Y+"_"+h+"_"+m+"_00.jpg";
	//	alert("No Image  : " + nowImage);
  		
  	//	var nextImg = new Image();
  	//	nextImg.onload = function() {
	//		loadSmartImage(nowImage);
  	//	}
  	//	nextImg.src = nowImage;
  //	};

  	img.src = nowImage; // fires off loading of image
  

	//var nowImage = "images/Default.PNG";
	
		  
		  
	//t=setTimeout('window.location.reload()',1000);

}

function checkTime(i)
{
	if (i<10)
	  {
	  i="0" + i;
	  }
	  
	if (i == 60)
		i = "00";
	return i;
}

</script> 
</head>

<body onload="loadImage()">

</body>
</html>
